-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: get passStyleOf from VataData if there #1676
Conversation
I think I would only suggest considering whether |
This might be an opportunity to christen the |
Haven't reviewed yet. I know that |
if (typeof globalThis?.VatData?.passStyleOf === 'function') { | ||
return globalThis.VatData.passStyleOf; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why put this check inside the maker instead of the actual passStyleOf
exported below? I know it'd become a less readable ternary, but it just feels strange to have a maker return a preexisting value, ignoring it's parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will not be bothered if this becomes a cascade of the two namespaces whatever they will be in time. It would be a very small scar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it'd become a less readable ternary,
It wasn't bad. Done.
0a59f21
to
bfb5641
Compare
Not really. The strong motivation comes from running user code in an on-chain virtualized environment, where the user's WeakMap would have been replaced with one that prevents the sensing of garbage collection on behalf of virtual objects. This make the motivating use so narrow that I'm gonna go ahead with the current name, for the sake of lower friction integration with agoric-adk. |
0c9fcef
to
7bfc8db
Compare
* @type {PassStyleOf} | ||
*/ | ||
export const passStyleOf = | ||
globalThis?.VatData?.passStyleOf || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, this is the only mention of VatData in all of endo, and one of only two non-spurious references to liveslots (the others looking like migration cruft). If fundamental modules are going to defer to their environment, it would be good to establish an endo convention supporting that while keeping it independent rather than inverting the usual dependency direction with agoric-sdk. My first thought would be Symbol-keyed properties, e.g.
globalThis?.VatData?.passStyleOf || | |
globalThis?.[Symbol.for('@endo passStyleOf')] || |
See Agoric/agoric-sdk#8051
If there is already a
VataData
global containing a function namedpassStyleOf
, then presumably it was endowed for us by liveslots, so we should use and export that one instead.